//
//  MainConrtroller.m
//  StatusBarEX
//
//  Created by Garenge on 2020/11/29.
//  Copyright © 2020 鹏鹏. All rights reserved.
//

#import "MainConrtroller.h"
#import <TZImagePickerController/TZImagePickerController.h>
#import "PPContentView.h"
#import "PPTimeOpeView.h"
#import "PPAlertView.h"
#import "MBProgressHUD+LZPShow.h"

#define PPBLOCKSELF __weak typeof(self) weakSelf = self;

typedef NS_ENUM(NSInteger, PPImageType) {
    PPImageType_Strength,
    PPImageType_Operator,
    PPImageType_Net_WiFi,
    PPImageType_Net_4G,
    PPImageType_Energy_power,
    PPImageType_Clock,
    PPImageType_Loc,
    PPImageType_Lock,
};

@interface MainConrtroller () <UIPickerViewDelegate, UIPickerViewDataSource, TZImagePickerControllerDelegate>

/// 操作区域背景图, 这些都是要设置圆角边框的
@property (weak, nonatomic) IBOutlet UIView *operationBGView;

/// 其余图标设置的背景图
@property (weak, nonatomic) IBOutlet UIView *otherBGView;

/// 选择时间的背景图
@property (weak, nonatomic) IBOutlet PPTimeOpeView *timeOpeView;

/// 状态栏高度选择器 背景图
@property (weak, nonatomic) IBOutlet UIView *statusBarPickerContentView;

/// 非操作区域背景图
@property (weak, nonatomic) IBOutlet UIView *viewerBackGroundView;
/// 预览部分的背景图
@property (weak, nonatomic) IBOutlet UIView *viewerBGView;
/// 原图展示区域
@property (weak, nonatomic) IBOutlet UIImageView *sourceIMV;
/// 修改后的图片展区域
@property (weak, nonatomic) IBOutlet UIView *contentBGView;
/// 展示的view
@property (nonatomic, strong) PPContentView *contentView;

/// 信号强度btn
@property (weak, nonatomic) IBOutlet UIButton *strengthButton;
/// 信号强度 1 / 2 表示高低, 默认1, 满信号
@property (nonatomic, assign) int strengthValue;

/// 运营商按钮
@property (weak, nonatomic) IBOutlet UIButton *operatorButton;
/// 运营商代号 三大运营商 0. 中国移动, 1. 中国电信, 2. 中国联通
@property (nonatomic, assign) int operatorValue;

/// 网络类型按钮
@property (weak, nonatomic) IBOutlet UIButton *netButton;
/// 是否是wifi / 4G, 默认wifi
@property (nonatomic, assign) BOOL isWifi;
/// wifi强度 1 / 2 表示高低, 默认1, 满信号
@property (nonatomic, assign) int netValue;

/// 是否是亮色系
@property (weak, nonatomic) IBOutlet UIView *isWhiteButtonBGView;
/// 调节亮/暗 按钮
@property (nonatomic, strong) UIButton *isWhiteButton;
/// 当前偏色, 默认暗色
@property (nonatomic, assign) BOOL isWhite;

/// 电量模式按钮
@property (weak, nonatomic) IBOutlet UIButton *energyButton;
/// 是否是带数字的 / 不带数字纯图标, 默认带数字
@property (nonatomic, assign) BOOL isEnergyNum;
/// 电池电量
@property (nonatomic, assign) int energyValue;
@property (weak, nonatomic) IBOutlet UIPickerView *energyPicker;

/// 支持手动调节状态栏高度, 默认20
@property (weak, nonatomic) IBOutlet UIPickerView *statusBarHeightPicker;
@property (nonatomic, assign) CGFloat statusBarHeight;
@property (nonatomic, strong) NSArray *statusBarHeightArray;

/// 锁定图片的按钮
@property (weak, nonatomic) IBOutlet UIButton *isLockedButton;
/// 定位的按钮
@property (weak, nonatomic) IBOutlet UIButton *isShowLocButton;
/// 闹钟的按钮
@property (weak, nonatomic) IBOutlet UIButton *isClockButton;

@property (weak, nonatomic) IBOutlet UIButton *reSelectButton;

@end

@implementation MainConrtroller

#pragma mark 准备数据
/// 运营商数组
- (NSArray *)operatorsArray {
    return @[@"中国移动", @"中国电信", @"中国联通"];
}
/// 电池电量数组
- (NSArray *)energyValueArray:(BOOL)isEnergyNum {
    if (isEnergyNum) {
        return @[@21, @23, @24, @26, @28, @30, @32, @35, @36, @37, @39, @40, @41, @43, @44, @47, @49, @50, @51, @53, @56, @58, @59, @60, @63, @65, @67, @68, @70, @72, @75, @77, @79, @80, @81, @83, @85, @86, @91, @93];
    } else {
        return @[@23, @30, @39, @46, @55, @62, @70, @87, @92, @95];
    }
}
/// 状态栏高度
- (NSArray *)statusBarHeightArray {
    if (nil == _statusBarHeightArray) {
        NSMutableArray *array = [NSMutableArray array];
        for (int i = 15; i < 35; i ++) {
            [array addObject:[NSNumber numberWithInt:i]];
        }
        _statusBarHeightArray = array;
    }
    return _statusBarHeightArray;
}

/// 获取图片资源, 图片格式都是有规律的
- (UIImage *)getImageWithType:(PPImageType)type value:(int)value {
    switch (type) {
        case PPImageType_Strength: {
            NSString *imageName = [NSString stringWithFormat:@"signal0%d%@", value, self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
        case PPImageType_Operator:
            
            break;
        case PPImageType_Net_WiFi: {
            NSString *imageName = [NSString stringWithFormat:@"wifi0%d%@", value, self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
        case PPImageType_Net_4G:
            
            break;
        case PPImageType_Energy_power: {
            NSString *imageName = [NSString stringWithFormat:@"battery%d%@%@", value, self.isEnergyNum ? @"_" : @"", self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
        case PPImageType_Clock: {
            NSString *imageName = [NSString stringWithFormat:@"clock%@", self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
        case PPImageType_Loc: {
            NSString *imageName = [NSString stringWithFormat:@"location%@", self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
        case PPImageType_Lock: {
            NSString *imageName = [NSString stringWithFormat:@"lock%@", self.isWhite ? @"white" : @"black"];
            return [UIImage imageNamed:imageName];
        }
            break;
    }
    return nil;
}

#pragma mark - 界面布局

/// 快捷设置圆角
- (void)setCornerRadiusOfView:(UIView *)view {
    view.layer.cornerRadius = 4;
    view.layer.borderColor = UIColor.lightGrayColor.CGColor;
    view.layer.borderWidth = 1;
    view.layer.masksToBounds = YES;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadMainView];
}

- (void)loadMainView {

    [self setCornerRadiusOfView:self.operationBGView];
    [self setCornerRadiusOfView:self.otherBGView];
    [self setCornerRadiusOfView:self.isWhiteButtonBGView];
    
    /// 设置图标颜色的按钮, 默认黑色
    self.isWhite = NO;
    CGRect whiteBGFrame = self.isWhiteButtonBGView.bounds;
    UIButton *isWhiteButton = [UIButton buttonWithType:UIButtonTypeSystem];
    isWhiteButton.backgroundColor = self.isWhite ? UIColor.whiteColor : UIColor.blackColor;
    isWhiteButton.frame = whiteBGFrame;
    [isWhiteButton addTarget:self action:@selector(changeWhiteValue:) forControlEvents:UIControlEventTouchUpInside];
    [self.isWhiteButtonBGView addSubview:isWhiteButton];
    self.isWhiteButton = isWhiteButton;
    
    [self setCornerRadiusOfView:self.timeOpeView];
    
    PPBLOCKSELF
    /// 时间选择器回调, 更新数据
    self.timeOpeView.timeChangdBlock = ^(NSString * _Nonnull timeString) {
        [weakSelf refreshTime];
    };
    
    [self setCornerRadiusOfView:self.statusBarPickerContentView];

    self.statusBarHeight = 20;
    [self.statusBarHeightPicker selectRow:5 inComponent:0 animated:YES];

    /// 开始初始化界面了
    [self reSelectPhoto:self.reSelectButton];
}

#pragma mark - 界面刷新
/// 刷新全部界面
- (void)refreshAllStatus {
    [self refreshStrengthValue];
    [self refreshOperatorValue];
    [self refreshNetValue];
    [self refreshEnergyValue];
    [self refreshOtherIcon];
    [self refreshStatusBarTextColor];
    [self refreshTime];
    [self refreshStatusBarHeight];
}

/// 刷新24小时还是12小时
- (void)refreshTimeFormat:(BOOL)formatRandom {

    NSString *timeFormat = self.timeOpeView.timeFormat;

    if (formatRandom) {
        // 重置一下时间格式(随机一个24小时或者上下午)
        int randomNum = arc4random() % 100;

        // 一半概率
        if (randomNum < 50) {
            // 24小时制
            timeFormat = @"HH:mm";
            
        } else {
            // 12小时制
            timeFormat = @"h:mm";
        }
        
//        self.timeOpeView.timeFormat = timeFormat;
    } else {
        // 就用上次的时间格式就好了
    }
    self.timeOpeView.timeFormat = timeFormat;
}

/// 刷新显示时间
- (void)refreshTime {
    self.contentView.timeLabel.text = self.timeOpeView.showTimeLabel.text;
}
/// 刷新状态栏高度
- (void)refreshStatusBarHeight {
    [self.contentView refreshStatusBarHeightWithHeight:self.statusBarHeight];
}

/// 刷新状态栏文字颜色
- (void)refreshStatusBarTextColor {
    [self.contentView refreshStatusBarTextColor:self.isWhite ? [UIColor whiteColor] : [UIColor blackColor]];
}

/// 刷新信号强度
- (void)refreshStrengthValue {
    [self.strengthButton setImage:[self getImageWithType:PPImageType_Strength value:self.strengthValue] forState:UIControlStateNormal];
    self.contentView.strengthIMV.image = [self getImageWithType:PPImageType_Strength value:self.strengthValue];
}
- (IBAction)changeStrengthValue:(id)sender {
    self.strengthValue = 3 - self.strengthValue;
    [self refreshStrengthValue];
}

/// 刷新运营商
- (void)refreshOperatorValue {
    [self.operatorButton setTitle:[self operatorsArray][self.operatorValue] forState:UIControlStateNormal];
    self.contentView.operatorLabel.text = [self operatorsArray][self.operatorValue];
}
- (IBAction)changeOperatorValue:(id)sender {
    self.operatorValue = (self.operatorValue + 1) % 3;
    [self refreshOperatorValue];
}

/// 刷新网络信号
- (void)refreshNetValue {
    if (self.isWifi) {
        [self.netButton setTitle:@"" forState:UIControlStateNormal];
        [self.netButton setImage:[self getImageWithType:PPImageType_Net_WiFi value:self.netValue] forState:UIControlStateNormal];
        [self.contentView refreshNetWith:self.isWifi value:[self getImageWithType:PPImageType_Net_WiFi value:self.netValue]];
    } else {
        [self.netButton setImage:nil forState:UIControlStateNormal];
        [self.netButton setTitle:@"4G" forState:UIControlStateNormal];
        [self.contentView refreshNetWith:self.isWifi value:nil];
    }
}
- (IBAction)changeNetValue:(id)sender {
    if (self.isWifi) {
        if (self.netValue == 1) {
            self.netValue = 2;
        } else {
            self.netValue = 1;
            self.isWifi = !self.isWifi;
        }
    } else {
        self.isWifi = !self.isWifi;
    }
    [self refreshNetValue];
    
}

/// 刷新亮色还是暗色
- (void)refreshWhiteValue {
    [self.isWhiteButton setBackgroundColor:self.isWhite ? UIColor.whiteColor : UIColor.blackColor];
    [self refreshAllStatus];
}
- (void)changeWhiteValue:(id)sender {
    self.isWhite = !self.isWhite;
    [self refreshWhiteValue];
}

/// 刷新电量
- (void)refreshEnergyValue {
    [self.energyButton setImage:[self getImageWithType:PPImageType_Energy_power value:self.energyValue] forState:UIControlStateNormal];
    [self.contentView refreshEnergyIMVWithImage:[self getImageWithType:PPImageType_Energy_power value:self.energyValue]];
}
/// 刷新电量 数字 / 图标
- (void)refreshEnergyNumWithDefault:(NSInteger)selectIndex {
    self.energyValue = [[self energyValueArray:self.isEnergyNum][selectIndex] intValue];
    [self refreshEnergyValue];
    [self.energyPicker reloadComponent:0];
    [self.energyPicker selectRow:selectIndex inComponent:0 animated:NO];
}
- (IBAction)changeEnergyMode:(id)sender {
    self.isEnergyNum = !self.isEnergyNum;
    [self refreshEnergyNumWithDefault:0];
}

- (IBAction)changeLockButtonClicked:(id)sender {
    self.isLockedButton.selected = !self.isLockedButton.selected;
    [self refreshOtherIcon];
}
- (IBAction)changeLocButtonClicked:(id)sender {
    self.isShowLocButton.selected = !self.isShowLocButton.selected;
    [self refreshOtherIcon];
}
- (IBAction)changeClockButtonClicked:(id)sender {
    self.isClockButton.selected = !self.isClockButton.selected;
    [self refreshOtherIcon];
}

- (void)refreshOtherIcon {
    NSMutableArray *images = [NSMutableArray array];
    if (self.isClockButton.isSelected) {
        [images addObject:[self getImageWithType:PPImageType_Clock value:0]];
    }
    if (self.isShowLocButton.isSelected) {
        [images addObject:[self getImageWithType:PPImageType_Loc value:0]];
    }
    if (self.isLockedButton.isSelected) {
        [images addObject:[self getImageWithType:PPImageType_Lock value:0]];
    }
    [self.contentView refreshRightIMVsWithImages:images];
}

#pragma mark - 按钮点击事件

/// 弹出界面让用户选择颜色和时间
- (void)alertToChooseSomeOption {
    PPBLOCKSELF
    
    PPAlertView *alertView = [PPAlertView showAlertViewWithAlreadyExistWhiteButton:self.isWhiteButton timeOpeView:self.timeOpeView.content];
    alertView.viewWillDismiss = ^{
        CGRect whiteBGBounds = weakSelf.isWhiteButtonBGView.bounds;
        weakSelf.isWhiteButton.frame = whiteBGBounds;
        [weakSelf.isWhiteButtonBGView addSubview:self.isWhiteButton];
        
        CGRect timeOpeBGBounds = weakSelf.timeOpeView.bounds;
        weakSelf.timeOpeView.content.frame = timeOpeBGBounds;
        [weakSelf.timeOpeView addSubview:self.timeOpeView.content];
    };
}

#pragma mark 选择图片
- (IBAction)selectImage:(id)sender {
    
    PPBLOCKSELF
    TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self];
    imagePickerVc.allowTakeVideo = NO;
    imagePickerVc.allowTakePicture = NO;
    imagePickerVc.allowPickingVideo = NO;
    imagePickerVc.allowPickingGif = NO;
    
    [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
        // 创建一个内容view
        if (photos.count == 0 || assets.count == 0) {
            return;
        }
        
        PHAsset *asset = assets[0];
        [weakSelf requestImageDataForAsset:asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
            PPContentView *contentView = [PPContentView createViewFromNib];
            CGRect windowBounds = UIApplication.sharedApplication.keyWindow.bounds;
            windowBounds.origin.y = 20;
            contentView.frame = windowBounds;
            
            UIImage *selectedImage = [UIImage imageWithData:imageData];
            contentView.image = selectedImage;
            weakSelf.sourceIMV.image = selectedImage;
            weakSelf.contentView = contentView;
            
            // 还需要做一件事情, 弹出界面让用户选择亮色和时间
            [weakSelf alertToChooseSomeOption];
            
            [weakSelf showSmallContentView:nil];
        } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
            
        }];
    }];
    [self presentViewController:imagePickerVc animated:YES completion:nil];
}

/// 获取原始图片
- (PHImageRequestID)requestImageDataForAsset:(PHAsset *)asset completion:(void (^)(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler {
    PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
        options.progressHandler = ^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
            if (progressHandler) {
                progressHandler(progress, error, stop, info);
            }
        };
        options.version = PHImageRequestOptionsVersionOriginal;
        options.networkAccessAllowed = YES;
        options.deliveryMode = PHImageRequestOptionsDeliveryModeFastFormat;
    //    options.resizeMode = PHImageRequestOptionsResizeModeFast;
        int32_t imageRequestID = [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
            if ([dataUTI.lowercaseString isEqualToString:@"public.heic"]) {
                CIImage *ciImage = [CIImage imageWithData:imageData];
                CIContext *context = [CIContext context];
                if (@available(iOS 10.0, *)) {
                    NSData *jpgData = [context JPEGRepresentationOfImage:ciImage colorSpace:ciImage.colorSpace options:@{}];
                    if (completion) completion(jpgData,dataUTI,orientation,info);
                } else {
                        // Fallback on earlier versions
                    if (completion) completion(imageData,dataUTI,orientation,info);
                }

            } else {
                if (completion) completion(imageData,dataUTI,orientation,info);
            }

        }];
        return imageRequestID;
}

#pragma mark 切换大图模式
/// 切换大图模式
- (void)showBigContentView:(UITapGestureRecognizer *)gesture {
    [self.contentView removeGestureRecognizer:gesture];
    
    [UIApplication.sharedApplication.keyWindow addSubview:self.contentView];
    self.contentView.frame = UIApplication.sharedApplication.keyWindow.bounds;
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showSmallContentView:)];
    [self.contentView addGestureRecognizer:tapGesture];
}

#pragma mark 切换小图模式
/// 切换小图模式
- (void)showSmallContentView:(UITapGestureRecognizer *)gesture {
    if (gesture) {
        [self.contentView removeGestureRecognizer:gesture];
        
        [self.contentView removeFromSuperview];
    }
    
    self.viewerBGView.hidden = NO;
    CGRect windowBounds = UIApplication.sharedApplication.keyWindow.bounds;
    windowBounds.origin.y = 20;
    self.contentView.frame = windowBounds;
    [self.contentBGView addSubview:self.contentView];
    
    [self refreshAllStatus];
    
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showBigContentView:)];
    [self.contentView addGestureRecognizer:tapGesture];
}

/// 重新选图, 随机显示图标
- (IBAction)reSelectPhoto:(id)sender {
    [self.contentView removeFromSuperview];
    self.contentView = nil;
    self.sourceIMV.image = nil;
    self.viewerBGView.hidden = YES;

    // 设置一些随机值
    int randomNum = arc4random() % 100;
    /// 新号卡强度 1占70%, 2占30%
    self.strengthValue = randomNum < 70 ? 1 : 2;

    /// 运营商名字 中国移动 0占10%, 中国电信 1占30%, 中国联通 2占20%
    randomNum = arc4random() % 100;
    self.operatorValue = randomNum < 50 ? 0 : (randomNum < 80 ? 1 : 2);

    /// 是否是wifi 随机时候全部是wifi
    self.isWifi = 1;

    /// WiFi信号强度, 1 占 70, 2占 30%
    randomNum = arc4random() % 100;
    self.netValue = randomNum < 70 ? 1 : 2;

    /// 设置时间(已自动)
    [self refreshTimeFormat:YES];

    /// 锁定, 定位, 闹钟, 随机取0-3个
    randomNum = arc4random() % 2;
    self.isLockedButton.selected = randomNum == 0;
    randomNum = arc4random() % 2;
    self.isShowLocButton.selected = randomNum == 0;
    randomNum = arc4random() % 2;
    self.isClockButton.selected = randomNum == 0;

    /// 电池电量, 有数字百分比的占 70%, 无数字的占30%
    randomNum = arc4random() % 100;
    self.isEnergyNum = randomNum < 70;

    /// 随机一个电量
    NSArray *energyValueArray = [self energyValueArray:self.isEnergyNum];
    NSInteger energyValueCount = energyValueArray.count;
    NSInteger randomIndex = arc4random() % energyValueCount;
    [self refreshEnergyNumWithDefault:randomIndex];

    [self refreshAllStatus];
}

#pragma mark 截屏保存相册
/// 截屏
- (UIImage *)snapshot:(UIView *)view {
    UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0);
    [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}
- (IBAction)savePhoto:(id)sender {
    if (self.contentView) {
        PPBLOCKSELF
        UIImage *snapImage = [self snapshot:self.contentView];
        [[TZImageManager manager] savePhotoWithImage:snapImage completion:^(PHAsset *asset, NSError *error) {
            if (nil == error) {
                [MBProgressHUD showInfoOnView:weakSelf.view WithStatus:@"保存成功" afterDelay:1];
            } else {
                [MBProgressHUD showInfoOnView:weakSelf.view WithStatus:@"保存失败" afterDelay:1];
            }
        }];
    } else {
        [MBProgressHUD showInfoOnView:self.view WithStatus:@"请先添加图片" afterDelay:1];
    }
}

#pragma mark - 代理
#pragma mark date picker
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
    return 1;
}
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
    if (pickerView == self.energyPicker) {
        return [self energyValueArray:self.isEnergyNum].count;
    } else {
        return self.statusBarHeightArray.count;
    }
}
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    if (pickerView == self.energyPicker) {
        NSArray *values = [self energyValueArray:self.isEnergyNum];
        return [NSString stringWithFormat:@"%@", values[row]];
    } else {
        NSArray *heights = self.statusBarHeightArray;
        return [NSString stringWithFormat:@"%@", heights[row]];
    }
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    if (pickerView == self.energyPicker) {
        // 选了电量
        NSArray *values = [self energyValueArray:self.isEnergyNum];
        self.energyValue = [values[row] intValue];
        [self refreshEnergyValue];
        NSLog(@"选择电量: %@", [NSString stringWithFormat:@"%@", values[row]]);
    } else {
        // 选了状态栏高度
        NSArray *heights = self.statusBarHeightArray;
        self.statusBarHeight = [heights[row] floatValue];
        if (self.contentView) {
            [self.contentView refreshStatusBarHeightWithHeight:self.statusBarHeight];
        }
        NSLog(@"选择状态栏高度: %@", [NSString stringWithFormat:@"%@", heights[row]]);
    }
}

#pragma mark 系统设置相关
/// 隐藏系统状态栏
- (BOOL)prefersStatusBarHidden {
    return YES;
}

/// 解决顶部下来手势冲突
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {
    return UIRectEdgeTop;
}

@end
